<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改</title>
    <link rel="stylesheet" href="css/update.css">
</head>
<body>
<div class="container">
    <h2>修改</h2>
    <form action="UserUpdateServlet" method="post">
        <div class="input-group">
            <label for="regUsername">id</label>
            <input type="number" id="Userid" name="id" required value="${user.id}">
        </div>
        <div class="input-group">
            <label for="regUsername">用户名</label>
            <input type="text" id="regUsername" name="username" required value="${user.username}">
        </div>
        <div class="input-group">
            <label for="regPassword">密码</label>
            <input type="password" id="regPassword" name="password" required value="${user.password}">
        </div>
        <div class="input-group">
            <label for="regEmail">邮箱</label>
            <input type="email" id="regEmail" name="email" required value="${user.email}">
        </div>
        <button type="submit">修改</button>
    </form>
</div>
<h3 class="alert" name="failMsg">${failMsg}</h3>
</body>
<script>
    let element = document.querySelector(".alert")
    element.style.display = "none"
    if (element.innerText === "1") {
        alert("你未填写用户或密码，无法注册")
    } else if (element.innerText === "用户已存在") {
        alert("用户已存在,请修改用户名")
    }
</script>
</html>